package com.kun.oa.controller.rest;

import com.kun.oa.service.IRoleService;
import com.kun.oa.vo.RespStat;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * restful风格URI的controller
 * 只和用户交换JSON数据
 * @author Administrator
 *
 */
@RestController
@RequestMapping("/api/v1/manager/role")
public class RoleManagerRestController {

	@Reference(version = "1.0.0")
	IRoleService roleSrv;

	@RequestMapping("Permission/add")
	public RespStat permissionadd(@RequestParam int[] permissions, @RequestParam int id) {

		RespStat stat = new RespStat();

		boolean res = roleSrv.addPermission(id, permissions);

		if (res){
			stat.setCode(200);
			stat.setMsg("更新成功！！");
			return stat;
		} else {
			stat.setCode(001);
			stat.setMsg("更新失败！！");
			return stat;
		}

	}

}
